package cn.com.okgo.callback;

import cn.com.okgo.cache.TCache;
import okhttp3.Response;
import okhttp3.ResponseBody;

/**
 * Created by luwenlong on 2017/8/29.
 */

public abstract class HttpStringCallback extends HttpCallback<String> {

    @Override
    public String parseNetworkResponse(Response response) throws Exception {
        String json = response.body().string();
        TCache.getInstance().put(json, response);
        return json;
    }

    @Override
    public String parseCacheResponse(ResponseBody responseBody) throws Exception {
        return responseBody.string();
    }

}
